<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.0.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/logo.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/logo.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Mist","darkmode":false,"version":"8.10.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

  <meta name="description" content="这是一篇交了学费的总结反思文，顺便回顾一下这五年。">
<meta property="og:type" content="article">
<meta property="og:title" content="2017-2022 重新捡起博客">
<meta property="og:url" content="http://example.com/2022/02/20/2017-2022/index.html">
<meta property="og:site_name" content="chenchu.zs&#39;s blog">
<meta property="og:description" content="这是一篇交了学费的总结反思文，顺便回顾一下这五年。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/2022/02/20/2017-2022/1.jpg">
<meta property="article:published_time" content="2022-02-20T05:21:52.000Z">
<meta property="article:modified_time" content="2022-08-03T23:31:59.157Z">
<meta property="article:author" content="Zhang Shu">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://example.com/2022/02/20/2017-2022/1.jpg">


<link rel="canonical" href="http://example.com/2022/02/20/2017-2022/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2022/02/20/2017-2022/","path":"2022/02/20/2017-2022/","title":"2017-2022 重新捡起博客"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>2017-2022 重新捡起博客 | chenchu.zs's blog</title>
  





  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">chenchu.zs's blog</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">仓鼠君的瓜子库</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%89%BE%E5%9B%9Egithub-page"><span class="nav-number">1.</span> <span class="nav-text">找回github page</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%A0%B9%E6%8D%AEhtml%E9%87%8D%E6%96%B0%E7%94%9F%E6%88%90markdown"><span class="nav-number">2.</span> <span class="nav-text">根据html重新生成markdown</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E9%87%8D%E6%96%B0%E6%90%AD%E5%BB%BAHEXO%E7%8E%AF%E5%A2%83"><span class="nav-number">3.</span> <span class="nav-text">重新搭建HEXO环境</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85nodejs"><span class="nav-number">3.1.</span> <span class="nav-text">安装nodejs</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85hexo%E5%B9%B6%E5%88%9D%E5%A7%8B%E5%8C%96%E5%8D%9A%E5%AE%A2"><span class="nav-number">3.2.</span> <span class="nav-text">安装hexo并初始化博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE"><span class="nav-number">3.3.</span> <span class="nav-text">主题配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AB%99%E7%82%B9%E4%BF%A1%E6%81%AF%E9%85%8D%E7%BD%AE"><span class="nav-number">3.4.</span> <span class="nav-text">站点信息配置</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0%E8%BF%81%E7%A7%BB"><span class="nav-number">4.</span> <span class="nav-text">博客文章迁移</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9C%A8hexo%E4%B8%AD%E6%B7%BB%E5%8A%A0%E5%8D%9A%E5%AE%A2"><span class="nav-number">4.1.</span> <span class="nav-text">在hexo中添加博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8D%9A%E6%96%87%E5%9F%BA%E6%9C%AC%E6%A0%B7%E5%BC%8F%E9%85%8D%E7%BD%AE"><span class="nav-number">4.2.</span> <span class="nav-text">博文基本样式配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9B%BE%E7%89%87%E6%AD%A3%E7%A1%AE%E5%B1%95%E7%A4%BA"><span class="nav-number">4.3.</span> <span class="nav-text">图片正确展示</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%AC%E5%BC%8F%E6%AD%A3%E7%A1%AE%E5%B1%95%E7%A4%BA"><span class="nav-number">4.4.</span> <span class="nav-text">公式正确展示</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8D%9A%E5%AE%A2%E9%83%A8%E7%BD%B2"><span class="nav-number">5.</span> <span class="nav-text">博客部署</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%94%9F%E6%88%90%E9%9D%99%E6%80%81%E9%A1%B5%E9%9D%A2%E5%B9%B6%E9%83%A8%E7%BD%B2"><span class="nav-number">5.1.</span> <span class="nav-text">生成静态页面并部署</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%83%A8%E7%BD%B2%E5%88%B0git-page"><span class="nav-number">5.2.</span> <span class="nav-text">部署到git page</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#gitee-page%E9%95%9C%E5%83%8F"><span class="nav-number">5.2.1.</span> <span class="nav-text">gitee page镜像</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%94%E5%B9%B4%E5%9B%9E%E9%A1%BE"><span class="nav-number">6.</span> <span class="nav-text">五年回顾</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Zhang Shu"
      src="/images/avatar.gif">
  <p class="site-author-name" itemprop="name">Zhang Shu</p>
  <div class="site-description" itemprop="description">积跬步以致千里</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">13</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/chenchu-zs" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;chenchu-zs" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2022/02/20/2017-2022/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Zhang Shu">
      <meta itemprop="description" content="积跬步以致千里">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chenchu.zs's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          2017-2022 重新捡起博客
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <font color=D81E06>[置顶] </font>
    <span class="post-meta-divider"></span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-02-20 13:21:52" itemprop="dateCreated datePublished" datetime="2022-02-20T13:21:52+08:00">2022-02-20</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2022-08-04 07:31:59" itemprop="dateModified" datetime="2022-08-04T07:31:59+08:00">2022-08-04</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E6%9D%82%E4%B8%83%E6%9D%82%E5%85%AB/" itemprop="url" rel="index"><span itemprop="name">杂七杂八</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>4.3k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>4 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>这是一篇交了学费的总结反思文，顺便回顾一下这五年。</p>
<span id="more"></span>
<p>作为一名程序员，一个存放自己知识和笔记的地方实在太重要了。最早自己搭建博客，后来因为总是随手记一些零零碎碎的知识点，对自己的博客有质量洁癖却没时间完整的总结成一个满意的系列，导致草稿箱里堆了很多，更新到网页上去的却很少。最后干脆放弃转而使用在线云笔记，从印象笔记换到为知笔记又用到语雀。几年下来笔记记了不少，但是大部分都很乱。想系统的回顾整理一下都无从下手。再加上因为工作了之后，公司限制员工使用在线笔记，总是被迫转移阵地。越来越觉得，写博客还是很重要的。</p>
<p>第一次搭建自己的博客是在2017年，当时买了云服务器和域名并使用hexo搭建的。过了一年之后域名失效，转而使用github page来托管。后来在转向使用在线云笔记的时候，服务器就放在那里吃灰了。某天忘记续费直接被回收，hexo仓库丢失无法更新，于是博客也彻底的被我弃用了，但既有博客还能继续访问。不巧的是前段时间心血来潮给github改了用户名，结果导致博客彻底挂了。被迫走上交学费挽救之路。在这里记录一下苦逼的挽救过程。</p>
<h1 id="找回github-page"><a href="#找回github-page" class="headerlink" title="找回github page"></a>找回github page</h1><p>首先我第一个想到的是把github用户名改回去先挽救我的博客页面，但github直接禁止改回历史名，只能另外想办法。<br>其实这个问题也很简单，用户名变了，导致github的page的域名也跟着变了，然而仓库里的html使用的还是老域名。所以只要把这些html的域名批量修改了就好。过程：git clone -&gt; sed 批量修改 -&gt; git commit 然后push回去。再次打开，博客页面可以访问了~ </p>
<h1 id="根据html重新生成markdown"><a href="#根据html重新生成markdown" class="headerlink" title="根据html重新生成markdown"></a>根据html重新生成markdown</h1><p>链接能访问后，博客的静态页面算是找回了，但是本身的markdown记录还是丢失的状态，因此需要重新生成一份。</p>
<ul>
<li>方法一：利用工具将html文件转成markdown格式，在github上找到了一个好用的工具: <a target="_blank" rel="noopener" href="https://mixmark-io.github.io/turndown/">turndown</a></li>
<li>方法二：利用语雀的格式识别和导出markdown的功能。</li>
</ul>
<p>最终我用的是方法二，因为方法一的html页面上带有很多hexo的信息，转换后冗余信息太多，另外无法获取正确的图片和LaTeX公式。</p>
<h1 id="重新搭建HEXO环境"><a href="#重新搭建HEXO环境" class="headerlink" title="重新搭建HEXO环境"></a>重新搭建HEXO环境</h1><p>之前搭的时候没有记录，好多步骤都忘了，现在重走一遍过程顺便保存一下搭建记录，以后说不定还用得到&#x3D;。&#x3D;</p>
<h2 id="安装nodejs"><a href="#安装nodejs" class="headerlink" title="安装nodejs"></a>安装nodejs</h2><p>由于我是在个人电脑上使用了wsl，安装nodejs参考微软的<a target="_blank" rel="noopener" href="https://docs.microsoft.com/zh-cn/windows/dev-environment/javascript/nodejs-on-wsl">官方文档</a></p>
<h2 id="安装hexo并初始化博客"><a href="#安装hexo并初始化博客" class="headerlink" title="安装hexo并初始化博客"></a>安装hexo并初始化博客</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br><span class="line">hexo init blog</span><br><span class="line">cd blog</span><br><span class="line">npm install</span><br><span class="line">hexo server</span><br></pre></td></tr></table></figure>
<blockquote>
<p>踩坑：需要关闭命令行梯子代理，否则会出现问题</p>
</blockquote>
<p>以上步骤之后，会在<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000/</a> 页面显示一个hello world的示例博客页</p>
<h2 id="主题配置"><a href="#主题配置" class="headerlink" title="主题配置"></a>主题配置</h2><p>默认的主题不好看，之前用的Next-mist主题，按照以下步骤配置：</p>
<ol>
<li><code>npm install hexo-theme-next</code></li>
<li>在<code>__config.yml</code>文件里修改<code>theme: next</code></li>
<li>配置mist模式：在next的<code>__config.yml</code>里修改 <code>scheme: Mist</code></li>
<li>配置页面显示选项 (修改next的__config.yml）：<ul>
<li>菜单选项：<code>menu</code>，打开<code>home/tag/archives</code>字段</li>
<li>代码主题：<code>codeblock</code>的字段，选择<code>atom-one-dark</code>主题</li>
<li>配置搜索博客的功能：参考<a target="_blank" rel="noopener" href="https://theme-next.js.org/docs/third-party-services/search-services">local search文档</a></li>
<li>侧栏设置：<code>position: right</code></li>
<li>头像设置：替换<code>/images/avatar.gif</code>，修改avatar字段</li>
<li>github设置：<code>github_banner</code>, enable设为true</li>
<li>网站logo设置：修改favicon的small和medium为自己的logo：<code>/images/logo.ico</code></li>
<li>字数显示和阅读时长：在config.yml中搜索<code>wordcount</code>，然后按照文档修改</li>
</ul>
</li>
</ol>
<h2 id="站点信息配置"><a href="#站点信息配置" class="headerlink" title="站点信息配置"></a>站点信息配置</h2><ol>
<li><p>整体信息配置：修改__config.yml的以下字段：</p>
 <figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">title: chenchu.zs<span class="number">&#x27;</span>s blog</span><br><span class="line">subtitle: <span class="string">&#x27;仓鼠君的瓜子库&#x27;</span></span><br><span class="line">description: <span class="string">&#x27;积跬步以致千里&#x27;</span></span><br><span class="line">keywords:</span><br><span class="line">author: Zhang Shu</span><br><span class="line">language: zh-CN</span><br><span class="line">timezone: <span class="string">&#x27;&#x27;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>配置标签和分类页面.</p>
 <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo new page tags</span><br><span class="line">hexo new page categories</span><br></pre></td></tr></table></figure>
<p>然后切换到对应的目录，编辑<code>index.md</code>。<br>示例，分类页面，切换目录到<code>source/categories</code>：</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: categories</span><br><span class="line">date: <span class="number">2022</span><span class="number">-02</span><span class="number">-27</span> <span class="number">13</span>:<span class="number">06</span>:<span class="number">46</span></span><br><span class="line">type: categories</span><br><span class="line">---</span><br><span class="line">杂七杂八</span><br><span class="line">算法与刷题</span><br></pre></td></tr></table></figure></li>
<li><p>TODO：配置自己的首页</p>
</li>
</ol>
<h1 id="博客文章迁移"><a href="#博客文章迁移" class="headerlink" title="博客文章迁移"></a>博客文章迁移</h1><h2 id="在hexo中添加博客"><a href="#在hexo中添加博客" class="headerlink" title="在hexo中添加博客"></a>在hexo中添加博客</h2><p>新建博客的命令如下：会在<code>source/_post</code>目录下生成一个相关的markdown文件。将之前所有的博客都用这种方式重新创建一遍</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new &#x27;&lt;post_title&gt;&#x27;</span><br></pre></td></tr></table></figure>

<h2 id="博文基本样式配置"><a href="#博文基本样式配置" class="headerlink" title="博文基本样式配置"></a>博文基本样式配置</h2><p>博文的markdown文件中需要做一些修改才可以展示一些前端的信息，详细见文档：<a target="_blank" rel="noopener" href="https://hexo.io/docs/front-matter">https://hexo.io/docs/front-matter</a>。基本配置如下：</p>
<ol>
<li><p>显示文档标题、日期、tag、分类等信息。在md文件最开始添加以下配置：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: <span class="language-xml"><span class="tag">&lt;<span class="name">post_title</span>&gt;</span></span></span><br><span class="line">date: 2022-02-20 13:21:52</span><br><span class="line"><span class="section">tags:</span></span><br><span class="line"><span class="section">---</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>配置显示博客阅读全文：在文章中任意位置添加<code>&lt;!-- more --&gt;</code></p>
</li>
<li><p>博客置顶</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm uninstall hexo-generator-index --save</span><br><span class="line">npm install hexo-generator-index-pin-top --save</span><br></pre></td></tr></table></figure>
<p>然后在文章的<code>front-matter</code>中设置<code>top: true</code>。这样文章就会置顶显示了，不过没有任何置顶标识，如果需要配置样式还需要修改如下：找到<code>/themes/next/layout/_macro/</code>里关于post的文件，在<code>&lt;div class=&quot;post-meta&quot;&gt;</code>的开始插入以下代码：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&#123;%- if post.top %&#125;</span><br><span class="line">  <span class="tag">&lt;<span class="name">font</span> <span class="attr">color</span>=<span class="string">D81E06</span>&gt;</span>[置顶] <span class="tag">&lt;/<span class="name">font</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">span</span> <span class="attr">class</span>=<span class="string">&quot;post-meta-divider&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">span</span>&gt;</span></span><br><span class="line">&#123;%- endif %&#125;</span><br></pre></td></tr></table></figure>
<p>效果展示如下：</p>
<img src="1.jpg" width="50%" height="50%"></li>
</ol>
<h2 id="图片正确展示"><a href="#图片正确展示" class="headerlink" title="图片正确展示"></a>图片正确展示</h2><p>参考文档<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/asset-folders.html">https://hexo.io/zh-cn/docs/asset-folders.html</a></p>
<ol>
<li>设置<code>post_asset_folder: true</code>，开启后<code>hexo new &lt;page&gt;</code>会在md的目录生成一个该博客的同名目录。将对应博客的资源放到这个路径中。</li>
<li>markdown文件会出现hexo generate时候图片路径显示不正确的问题，注意文档中的这个例子，在写路径的时候要忽略资源文件夹的名称。<blockquote>
<p>eg：<code>image.jpg</code> is located at <code>/2020/01/02/foo/image.jpg</code>, meaning it is an asset image of <code>/2020/01/02/foo/</code> post, <code>![](image.jpg)</code> will be rendered as <code>&lt;img src=&quot;/2020/01/02/foo/image.jpg&quot;&gt;</code>.</p>
</blockquote>
</li>
</ol>
<h2 id="公式正确展示"><a href="#公式正确展示" class="headerlink" title="公式正确展示"></a>公式正确展示</h2><p>网上有好多教程，但是我实际操作下来并没有那么麻烦，无需卸载和重装什么东西，只需要在<code>next/_config.yml</code>里找到math参数，把<code>every_page</code>设为<code>true</code>, 选择渲染引擎为<code>mathjax</code>即可。</p>
<h1 id="博客部署"><a href="#博客部署" class="headerlink" title="博客部署"></a>博客部署</h1><h2 id="生成静态页面并部署"><a href="#生成静态页面并部署" class="headerlink" title="生成静态页面并部署"></a>生成静态页面并部署</h2><p>命令如下：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo generate</span><br><span class="line">hexo deploy</span><br></pre></td></tr></table></figure>
<h2 id="部署到git-page"><a href="#部署到git-page" class="headerlink" title="部署到git page"></a>部署到git page</h2><p>首先安装git部署插件:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>修改<code>_config.yml</code>的deploy字段（文件的注释中有相应的教程文档），我的配置如下：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">&#x27;git&#x27;</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">https://github.com/chenchu-zs/chenchu-zs</span></span><br><span class="line">  <span class="attr">branch:</span> <span class="string">master</span></span><br></pre></td></tr></table></figure>
<p>修改完之后执行以下命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo deploy</span><br></pre></td></tr></table></figure>
<h3 id="gitee-page镜像"><a href="#gitee-page镜像" class="headerlink" title="gitee page镜像"></a>gitee page镜像</h3><p>github的站点在美国，经常出现访问速度过慢或者网页打不开的情况，所以可以使用国内的git平台来加快启动。<br>曾经我直接把git指定为gitee的仓库并启用了gitee page，但是gitee的page服务不能自动更新，最终又切回到github了。<br>这里要说一下，之前的博客我用的是github page，但是由于github访问太慢，时不时抽风404，最终决定切换到国内的gitee，国产平台真香，新建仓库时可以使用各种模板，还能创建免费的私有库，非常好用啊~</p>
<h1 id="五年回顾"><a href="#五年回顾" class="headerlink" title="五年回顾"></a>五年回顾</h1><p>2017年5月，我拿到了第一个实习offer。<br>企业的环境比起学校来说，对能力的锻炼是飞速的。在第一家实习公司我学到了如何快速的完成工业项目的需求。在第二家实习公司我学到了开源项目的协同合作开发和测试流程。在第三家实习公司培我逐渐培养起了解决问题的方法论，以及学到了一点怎么去做一些探索性的东西的思路。</p>
<p>而从毕业到现在，我也在这第三家公司待了两年多了。在第一份实习里，带我的mentor是一个工作两年的师兄，一个非常靠谱的人。如今我也是个毕业两年多的人了，也开始带新人了，有时候恍惚回想起五年前，一边感激当年的前辈，一边也会想着怎么能像当前师兄带我一样去帮助新人成长。</p>
<p>五年带给人的变化不止是从新人变成熟练工这么简单，我从最早的C++后端，到高性能计算以及现在的AI infra方向，不知不觉方向也经历了很大的变动。到今天这个时间节点，AI infra已经是一个从业者众多，卷成红海一样的方向了。很多大公司都试图提出自己的解决方案，这导致这个方向的技术，非常的碎片化。</p>
<p>有时候我也会觉得迷茫和心累，并不知道这是否是个可持续的方向。也会想象一下，再过五年我会做哪个领域的东西呢？五年时间深度学习技术经历了翻天覆地的变化，从CV到NLP，新的方案不停被推出。或许再过五年，现在我非常熟悉和擅长的东西也已经过时了。</p>
<p>时代滚滚向前，不努力更新知识就会被甩下去，如今我能做的也只有保持持续学习和知识记录这一条路了。<br>仅以此文置顶，激励自己坚持更新博客和自己的知识体系。</p>

    </div>

    
    
    

    <footer class="post-footer">

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/11/01/conan/" rel="prev" title="C++依赖管理conan">
                  <i class="fa fa-chevron-left"></i> C++依赖管理conan
                </a>
            </div>
            <div class="post-nav-item">
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Zhang Shu</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">22k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">20 分钟</span>
  </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>





  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>



</body>
</html>
